package constant;

import util.CodeWriterUtil;

import javax.swing.JFrame;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

public class Constant {

	public static JFrame frmv;

	public static final String projectName = "freeOut";

	public static String modelFiles = "C:" + File.separator + "codeManConfig" + File.separator + "modelFiles" + File.separator + "";

	public static String modelFilesZip = "C:" + File.separator + "codeManConfig" + File.separator + "modelFiles" + File.separator + "model.zip";

	public static String staticZip = "C:" + File.separator + "codeManConfig" + File.separator + "modelFiles" + File.separator + "static.zip";

	public static String webClientZip = "C:" + File.separator + "codeManConfig" + File.separator + "modelFiles" + File.separator + "webClient.zip";

	public static String mvcSettingsZip = "C:" + File.separator + "codeManConfig" + File.separator + "modelFiles" + File.separator + "mvcSettings.zip";

	public static String settingsZip = "C:" + File.separator + "codeManConfig" + File.separator + "modelFiles" + File.separator + "settings.zip";

	public static String libZip = "C:" + File.separator + "codeManConfig" + File.separator + "modelFiles" + File.separator + "lib.zip";

	public static final String zipPwd = "beautiful123,,#@";

	// 获取激活文件
	public static String lifePropertiesPath = "C:" + File.separator + "codeManConfig" + File.separator + "codeManSdk" + File.separator + "bin" + File.separator + "server" + File.separator + "life.properties";

	// 项目根目录
	public static final String freeOutPath = "" + File.separator + "freeOut" + File.separator + "";

	public static final String freeOutPath_lib_MVC = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "webapp" + File.separator + "WEB-INF" + File.separator + "lib" + File.separator + "";

	public static final String freeOutPath_lib = "" + File.separator + "freeOut" + File.separator + "lib" + File.separator + "";

	public static final String freeOutPath_METAINF_MVC = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "webapp" + File.separator + "META-INF" + File.separator + "";

	public static final String mainApplicationPath = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "";

	public static final String testPath = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "test" + File.separator + "java" + File.separator + "freeOut" + File.separator + "";

	public static final String freeOutPath_controller = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "controller" + File.separator + "";

	public static final String freeOutPath_core = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "core" + File.separator + "";

	public static final String freeOutPath_core_annotation = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "core" + File.separator + "annotation" + File.separator + "";

	public static final String freeOutPath_core_validates = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "core" + File.separator + "validates" + File.separator + "";

	public static final String freeOutPath_dto = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "dto" + File.separator;

	public static final String freeOutPath_core_exception = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "core" + File.separator + "exception" + File.separator + "";

	public static final String freeOutPath_service = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "service" + File.separator + "";

	public static final String freeOutPath_serviceImpl = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "service" + File.separator + "impl" + File.separator + "";

	public static final String freeOutPath_dao = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "dao" + File.separator + "";

	public static final String freeOutPath_entity = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "entity" + File.separator + "";

	public static final String freeOutPath_constant = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "constant" + File.separator + "";

	public static final String freeOutPath_resources = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "";

	public static final String freeOutPath_sqlMapper = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "sqlmapper" + File.separator + "";

	public static final String freeOutPath_sqlMapper_MVC = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "sqlmapper" + File.separator + "";

	public static final String freeOutPath_static = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "static" + File.separator + "mystatic" + File.separator + "";

	public static final String freeOutPath_static_MVC = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "webapp" + File.separator + "mystatic" + File.separator + "";

	public static final String freeOutPath_templates = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "templates" + File.separator + "";

	public static final String freeOutPath_WEBINF_MVC = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "webapp" + File.separator + "WEB-INF" + File.separator + "";

	public static String downSettingsZipNet = "/zip/settings.zip";

	public static String downMvcSettingsZipNet = "/zip/mvcSettings.zip";

	public static final String freeOutPath_settings = "" + File.separator + "freeOut" + File.separator + ".settings" + File.separator + "";

	public static String downStaticZipNet = "/zip/static.zip";

	public static String downWebClientZipNet = "/zip/webClient.zip";

	public static String downLibZipNet = "/zip/lib.zip";

	public static final String utilPath = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "utils" + File.separator + "";

	public static final String mvcConfig = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + "freeOut" + File.separator + "config" + File.separator + "";

	public static String everythingZip = "/zip/everything.zip";

	public static final String everythingDownLoadDir = "C:" + File.separator + "codeManConfig" + File.separator + "everything" + File.separator + "";

	public static final String everythingExeName = "C:" + File.separator + "codeManConfig" + File.separator + "everything" + File.separator + "Everything.exe";

	public static String dubboModelZip = "/zip/dubboModel.zip";

	public static String cloudModelZip = "/zip/cloudModel.zip";

	public static String gitIpAdressFilePath = "C:" + File.separator + "codeManConfig" + File.separator + "codeManIp" + File.separator + "ip.txt";

	public static String gitConfigFilePath = "C:" + File.separator + "codeManConfig" + File.separator + ".git";

	public static final String webClientPath = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "static" + File.separator + "";

	public static final String webClientPathMVC = "" + File.separator + "freeOut" + File.separator + "src" + File.separator + "main" + File.separator + "webapp" + File.separator + "";

	public static final String webClientHtmlPath = webClientPath + "views" + File.separator + "";

	public static final String webClientHtmlPathMVC = webClientPathMVC + "views" + File.separator + "";

	public static final String webClientJsConfigPath = webClientPath + "js" + File.separator + "config" + File.separator + "";

	public static final String webClientJsConfigPathMVC = webClientPathMVC + "js" + File.separator + "config" + File.separator + "";

	public static final String MAC_OS = "Mac OS";

	public static final String WINDOWS = "Windows";

	static {
		//如果是mac系统
		if (Constant.MAC_OS.equals(CodeWriterUtil.getSystemType())) {
			modelFiles = "/Applications/codeManConfig/modelFiles/";
			modelFilesZip = "/Applications/codeManConfig/modelFiles/model.zip";
			staticZip = "/Applications/codeManConfig/modelFiles/static.zip";
			webClientZip = "/Applications/codeManConfig/modelFiles/webClient.zip";
			mvcSettingsZip = "/Applications/codeManConfig/modelFiles/mvcSettings.zip";
			settingsZip = "/Applications/codeManConfig/modelFiles/settings.zip";
			libZip = "/Applications/codeManConfig/modelFiles/lib.zip";
			lifePropertiesPath = "/Applications/codeManConfig/codeManSdk/Home/life.properties";
			gitIpAdressFilePath = "/Applications/codeManConfig/codeManIp/ip.txt";
			gitConfigFilePath = "/Applications/codeManConfig/.git";
		}
		File ipFile = new File(Constant.gitIpAdressFilePath);
		try (BufferedReader reader = new BufferedReader(new FileReader(ipFile))) {
			String ipPath = reader.readLine();
			Constant.downSettingsZipNet = ipPath + Constant.downSettingsZipNet;
			Constant.downMvcSettingsZipNet = ipPath + Constant.downMvcSettingsZipNet;
			Constant.downStaticZipNet = ipPath + Constant.downStaticZipNet;
			Constant.downWebClientZipNet = ipPath + Constant.downWebClientZipNet;
			Constant.downLibZipNet = ipPath + Constant.downLibZipNet;
			Constant.everythingZip = ipPath + Constant.everythingZip;
			Constant.dubboModelZip = ipPath + Constant.dubboModelZip;
			Constant.cloudModelZip = ipPath + Constant.cloudModelZip;
		} catch (Exception ignored) {
		}
	}


}
